package com.gsm.processor;

import com.gsm.entity.Person;
import com.gsm.log.MyLogger;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

import java.util.Arrays;

@Component
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		Person bean = beanFactory.getBean(Person.class);
		MyLogger.log("postProcessBeanFactory", bean);
		String[] beanDefinitionNames = beanFactory.getBeanDefinitionNames();
		Arrays.asList(beanDefinitionNames).stream().forEach(l -> MyLogger.log("beanDefinitionName", l));
		MyLogger.separator();
	}
}
